﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace StockPredictor.Models
{
    public class HighStockPointModel
    {
        #region Properties

        /// <summary>
        /// Represents the name of the stock
        /// </summary>
        public string stockName { get; set; }

        /// <summary>
        /// Represents the x-axis value (Timestamp)
        /// </summary>
        public double x { get; set; }

        /// <summary>
        /// Represents the opening value for the stock point
        /// </summary>
        public double open { get; set; }

        /// <summary>
        /// Represents the high value for the stock point
        /// </summary>
        public double high { get; set; }

        /// <summary>
        /// Represents the low value for the stock point 
        /// </summary>
        public double low { get; set; }

        /// <summary>
        /// Represents teh closing value for the stock point
        /// </summary>
        public double close { get; set; }

        #endregion Properties

        #region Constructors

        /// <summary>
        /// Constructor allowing the creationg of a highstock point model object
        /// </summary>
        /// <param name="timeValue">DateTime object for this point</param>
        /// <param name="openingValue">Stock Opening Value</param>
        /// <param name="highValue">Stock High Value</param>
        /// <param name="lowValue">Stock Low Value</param>
        /// <param name="closingValue">Stock Closing Value</param>
        public HighStockPointModel(string stockName, DateTime timeValue, double openingValue, double highValue, double lowValue, double closingValue)
        {
            this.stockName = stockName;
            this.x = (timeValue - new DateTime(1970, 1, 1)).TotalMilliseconds;
            this.open = openingValue;
            this.high = highValue;
            this.low = lowValue;
            this.close = closingValue;
        }

        public HighStockPointModel(HistoricalStock stock)
        {
            this.stockName = stock.Symbol;
            this.x = (stock.TradeDate - new DateTime(1970, 1, 1)).TotalMilliseconds;
            this.open = stock.Open;
            this.high = stock.High;
            this.low = stock.Low;
            this.close = stock.Close;
        }

        #endregion Constructors
    }
}